package com.hutianao.gqgl.information.bspi.service.impl;

import com.hutianao.gqgl.information.bspi.entity.SearchBspiEntity;
import com.hutianao.gqgl.information.bspi.respository.BspiDao;
import com.hutianao.gqgl.information.bspi.service.BspiService;
import com.hutianao.gqgl.mybatis.entity.CoalBspiEntity;

import com.hutianao.gqgl.mybatis.flexigrid.PaddingEntity;
import com.hutianao.gqgl.mybatis.flexigrid.PadingRstType;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
public class BspiServiceImpl implements BspiService {
    @Resource
    private BspiDao bspiDao;

    @Override
    public PadingRstType<CoalBspiEntity> queryBspiInfoListByPage(SearchBspiEntity search, PaddingEntity padding) {
        padding.deal(CoalBspiEntity.class);
        PadingRstType<CoalBspiEntity> padingRstType = new PadingRstType<>();
        padingRstType.setPage(padding.getPage());
        List<CoalBspiEntity> list = bspiDao.queryBspiInfoListByPage(search,padding);
        padingRstType.setRawRecords(list);
        Integer total = bspiDao.queryBspiInfoTotal(search);
        padingRstType.setTotal(total);
        padingRstType.putItems();

        return padingRstType;
    }
}
